/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.itttq.gshop.domain.po.SysAdPo;
import com.itttq.gshop.domain.to.ResultPageTo;
import com.itttq.gshop.pbpm.mapper.ISysAdMapper;

@Service
public class SysAdService {
	@Autowired
	private ISysAdMapper sysAdMapper;
	
	/**
	 * 根据ID获取SysAdPo对象
	 * 
	 * @param id
	 * @return
	 * @Author 迷蝶
	 * @return SysAdPo
	 */
	public SysAdPo getSysAd(int id) {
		return sysAdMapper.findSysAdById(id);
	}
	
	/**
	 * 根据条件获取SysAdPo对象，并返回查询的数据总数
	 * 
	 * @param sysAd
	 * @Author 迷蝶
	 * @return ResultPageTo<SysAdPo>
	 */
	public ResultPageTo<SysAdPo> getSysAds(SysAdPo sysAd) {
		return new ResultPageTo<SysAdPo>(sysAd.getStart(), sysAd.getSize(), 
				sysAdMapper.findSysAdCount(sysAd), sysAdMapper.findSysAds(sysAd));
	}
	
	/**
	 * 根据ID删除SysAdPo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 */
	public Integer delSysAd(int id) {
		return sysAdMapper.delSysAdById(id);
	}
	
	/**
	 * 增加SysAdPo对象
	 * 
	 * @param sysAd
	 * @Author 迷蝶
	 */
	public Integer addSysAd(SysAdPo sysAd) {
		return sysAdMapper.addSysAd(sysAd);
	}
	
	/**
	 * 根据条件更新SysAdPo对象
	 * 
	 * @param sysAd
	 * @Author 迷蝶
	 */
	public Integer updateSysAd(SysAdPo sysAd) {
		return sysAdMapper.updateSysAd(sysAd);
	}
	
}
